package org.example.executor.statement;

import org.example.executor.Executor;
import org.example.executor.parameter.ParameterHandler;
import org.example.executor.result.ResultSetHandler;
import org.example.mapping.BoundSql;
import org.example.mapping.MappedStatement;
import org.example.session.ResultHandler;
import org.example.session.RowBounds;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

public class BaseStatementHandler implements StatementHandler {

    private final Executor wrapper;
    private final MappedStatement ms;
    private final Object parameter;
    protected final ResultSetHandler resultSetHandler;
    protected final BoundSql boundSql;
    private final ResultHandler resultHandler;
    protected ParameterHandler parameterHandler;

    public BaseStatementHandler(Executor wrapper, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {
        this.wrapper = wrapper;
        this.ms = ms;
        this.parameter = parameter;
        this.resultHandler = resultHandler;
        this.boundSql = boundSql;
        this.parameterHandler   = ms.getConfiguration().newParameterHandler(ms,parameter,boundSql);
        this.resultSetHandler = ms.getConfiguration().newResultSetHandler(wrapper, ms, rowBounds, parameterHandler, resultHandler, boundSql);
    }

    @Override
    public <E> List<E> query(Statement statement, ResultHandler resultHandler) throws SQLException {
        return null;
    }

    @Override
    public BoundSql getBoundSql() {
        return null;
    }

    @Override
    public Statement prepare(Connection connection) throws SQLException {
        return null;
    }

    @Override
    public void parameterize(Statement stmt) {

    }
}
